MoveAxisRelative
下達一個目標為特定相對位置之運動指令。呼叫此命令時,給定之相對距離將添加於當前設置位置。
語法
KsCommandStatus MoveAxisRelative(
int Index,
double Distance,
double Velocity,
double Acceleration,
double Deceleration,
double Jerk,
McBufferMode BufferMode
);
參數
Index [in]:軸索引。索引以零為起點;別名將影響此參數。
Distance [in]:運動的相對距離,[單位]。
Velocity [in]:最大速度值,(非必要到達)[單位/秒]
Acceleration [in]:加速度值,單位由 McProfileType 類型決定,(馬達的增加能源) [單位/秒2] 或 [秒]。
Deceleration [in]:減速度值,單位由 McProfileType 類型決定,(馬達的減少能源) [單位/秒2] 或 [秒]。
Jerk [in]:加加速度值,單位由 McProfileType 類型決定,為 [單位/秒3] 或 [秒]。
BufferMode [in]:定義如何融合兩功能的速度,請見 McBufferMode 類型。
回傳值
返回 KsCommandStatus 結構。
備註
範例
VOID MoveRelative(INT Index, DOUBLE Distance) {
//Start an relative move.
KsCommandStatus status = WaitForCommand(30, TRUE, MoveAxisRelative(Index, Distance,
3600, 36000, 36000, 3600000, mcAborting));
//Print the final position.
double setPosition = 0;
KsError nRet = GetAxisPosition(Index, mcSetValue, &setPosition);
double actPosition = 0;
nRet = GetAxisPosition(Index, mcSetValue, &actPosition);
RtPrintf("Current Position: Target %d, Actual %d\n", (int)setPosition, (int)actPosition);
}
使用需求
RT | Win32 | |
---|---|---|
最低支援版本 | 4.0 | 4.0 |
標頭檔 | ksmotion.h | ksmotion.h |
程式庫 | KsApi_Rtss.lib | KsApi.lib |
參見